package routers

import (
	"github.com/gin-gonic/gin"
	"ruoyi/config"
	"ruoyi/infrastructure/persistence"
	"ruoyi/interfaces/middleware"
	"ruoyi/routers/all"
)

// Init 初始化
func Init(s *persistence.SystemRepositories, m *persistence.MonitorRepositories) *gin.Engine {
	gin.SetMode(config.Server.RunMode)
	r := gin.New()
	r.Use(middleware.Recover)

	all.InitTest(r, s, m)
	// 设置信任网络 []string
	// nil 为不计算，避免性能消耗，上线应当设置
	_ = r.SetTrustedProxies(nil)
	return r
}
